package org.springframework.samples.mvc.basic.partner;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.mvc.basic.business.AbstractBusinessService;
import org.springframework.samples.mvc.basic.business.Transformer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.proba.annotations.GenericDAO;
import com.proba.annotations.PartnerDAO;
import com.proba.annotations.pojo.Partner;

@Service
public class PartnerBusinessServiceImpl extends AbstractBusinessService<Partner, PartnerView> implements PartnerBusinessService {
	
	@Autowired
	private PartnerDAO dao;
	private PartnerTransformer transformer = new PartnerTransformer();

	@Override
	@Transactional
	public List<PartnerView> findAll(int startIndex, int pageSize,
			PartnerView queryInfo) {
		return transform(dao.findByFilterParams(startIndex, pageSize, queryInfo.getId(), queryInfo.getPartner(), queryInfo.getInvestitor(), queryInfo.getTehnickiBroj(), queryInfo.getTipPartner()));
	}

	@Override
	protected GenericDAO<Partner, Long> getDao() {
		return dao;
	}

	@Override
	protected Transformer<Partner, PartnerView> getTransformer() {
		return transformer;
	}

}
